1. Field of the Invention
The present invention relates to a communication apparatus, a control method for a communication apparatus, and a computer program, which are suitably used for disconnecting a communication line after a termination of a wait state.
2. Description of the Related Art
In network communication, there has conventionally been known a communication apparatus that performs communication by using a communication protocol for guaranteeing communication reliability. For such a communication protocol, there is a protocol for monitoring a communication status for a given period of time by using a timer. For example, a transmission control protocol (TCP) used in Internet is known. Features of the TCP are connection type communication, a packet retransmission function, and a flow control function.
Basic specification of the TCP is described in RFC 793 of request for comment (RFC) which is an official standard for all relating to the Internet. A communication procedure of the TCP starts with allocation of a communication endpoint of a host computer (hereinafter, referred to as “host”). When referring to Berkeley socket interface, this allocation is the processing corresponding to a socket system call. The communication endpoint established by the socket system call is referred to as a socket. Thus, a given amount of resources necessary for communication is allocated.
Then, connection processing is performed for a specific application of a host at the other end. In this connection processing, a packet for connection is actually transmitted/received. This processing corresponds to a connect system call in the socket interface. After completion of the connection, data transmission/reception is enabled, and data is transmitted/received. After completion of the data transmission/reception, communication for disconnection processing is performed. After completion of the communication, the communication endpoint is deleted, and the resources for communication are released. In other words, the communication line is released. This disconnection processing corresponds to a close system call in the socket interface.
In the TCP communication, a disconnection wait state TIME_WAIT is generally changed to a disconnected state CLOSED by using a timer after a passage of a given period of time (2MSL (Max Segment Lifetime)). In performing mounting, a value of one minute to four minutes is principally set as 2MSL time in the timer, and the state is changed to CLOSED after a timeout. Such waiting for a passage of a given period of time is carried out for the purpose of checking whether an ACK packet transmitted from an own host has surely reached the host at the other end.
More specifically, the own host transmits an ACK packet to the host at the other end and shifts to TIME_WAIT. However, the ACK packet may be lost for one reason or another and does not reach the host at the other end. When the ACK packet transmitted from the own host does not reach the host at the other end, the host at the other end retransmits a FIN packet. Hence, the own host must return an ACK packet corresponding to the retransmitted FIN packet to normally finish disconnection from the host at the other end. Thus, in order to check a retransmitted FIN packet, a wait state of 2MSL time, in other words, a connected state with the host at the other end, must be maintained.
In the TCP communication, during packet reception, in order to determine which connection the received packet is addressed to, TCP socket searching is performed. Thus, a network protocol processing apparatus includes a TCP socket search table that stores, for each connection, socket information containing a port number at the other end, an own port number, an IP address at the other end, and an own IP address. During the packet reception, searching is performed in the TCP socket search table based on “OWN PORT NUMBER”, “PORT NUMBER AT OTHER END, “OWN IP ADDRESS”, and “IP ADDRESS AT OTHER END” set in the packet, thereby determining which connection the packet is addressed to.
In the conventional communication apparatus, the TCP socket search table is stored in an internal memory to achieve a high speed for TCP socket searching, thereby improving communication performance. However, in order to check normal completion of disconnection from the host at the other end, even during a wait for a passage of 2MSL time, socket information must be secured in the TCP socket search table to enable communication at all times. Thus, when new connection of a communication line is established, the internal memory may not have any free space for storing new socket information. In such a case, there is a problem that it is necessary to wait until TIME_WAIT is finished for one of the communication lines to release the internal memory.
Especially, in a status where a cycle of connection and disconnection with the communication line is short, although data communication is completed, there are many communication endpoints which are not set open due to TIME_WAIT. In a device such as a built-in device that allows only an internal memory of a limited capacity, the internal memory may run short, frequently causing a wait until new connection of a communication line is established.
Under these circumstances, a method has been proposed, which can quickly establish new connection by quickly using a communication line of a TIME_WAIT state while maintaining reliability of communication as much as possible. Japanese Patent Application Laid-Open No. 2000-349856 discusses a technology capable of establishing a new communication line when the internal memory runs short and new connection of a communication line cannot be established, by releasing an internal memory secured by a communication line which has first shifted to TIME_WAIT, irrespective of a passage of time of TIME_WAIT.
However, in the technology discussed in Japanese Patent Application Laid-Open No. 2000-349856, a period of data transfer time is very short and, in a status where a cycle from new allocation of a communication endpoint to disconnection is short, a state shifts to CLOSE for new connection without any wait for a passage of 2MSL time after shifting to TIME_WAIT. Thus, setting of 2MSL time is meaningless, and an influence on reliability of communication cannot be ignored.